home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Software Vault: The Gold Collection
/
Software Vault - The Gold Collection (American Databankers) (1993).ISO
/
cdr52
/
clptick.zip
/
TICKER.DOC
< prev
next >
Wrap
Text File
|
1993-04-07
|
4KB
|
76 lines
I have, on occasion, wondered how you would attach a Clipper function
to the system clock for periodic evaluation ( Usually when I had an urgent
need to do so). With the aid of a few books ( namely Undoccumented DOS and
the DOS Programmer's Reference) and a friend of mine for help with the
Assembly routines an attempt was made, the results of which is in your hands.
I should point out that this routine was written by me in attempt to get
C interrupt acquainted and that there are other routines out there that
will work for you with a lot less hassel -- namely NetLib's N_SETTIME().
Many thanks go to John MacDonald, who identified and help to resolve a
rather nasty bug in the original version which led to system hangs and
stack errors. The solution was to check the dos safe flag before calling
the user defined routine ( a nasty oversight on my part). This seems to
resolve the problem. The odd thing about this is that I figured that
I would simply pass the status of the dos safe flag to the clipper udf
and leave it up to the udf to be responsible and not call a dos function
( Thereby permitting the udf to perform non dos functions uninhibited).
This didn't work -- If the dos safe flag was False the system hangs AFTER
the clipper routine is called and BEFORE it arrives ( I call the function
but it never gets there EVEN if the clipper udf did not call a dos routine).
I wonder if clipper background garbage collection may have something
to do with this. Not being able to resolve this issue adequately, I simply
programmed the timer routine to not call the clipper udf when the dos safe
flag is false, but to call it as soon as it becomes available. The downshot
of this approach is that if you use ticker() to display a clock
(for instance) and your main program issues a COPY TO, or similar dos,
command -- your clock routine will not display when dos is active
(while the copy to is copying). If ANYONE knows why this happens, or has a
better approach than using the dos safe flag, PLEASE let me know.
In order to use this routine you should set STACKS=0,0 in your config.sys
IT is EXTREMELY important that you remember to shutdown the ticker()
routine BEFORE you terminate your application. If you don't you are
guaranteed to force yourself into a re-boot situation. You might want
to put a ticker(0) call in your error handler so that if you encounter
any fatal runtime errors in your application while you are developing it
you won't have to continualy re-boot your system.
You should have three programs -- ticker.prg, tickerc.c, and msasm.asm.
and the object modules tickerc.obj and msasm.obj.
Ticker.prg:
This is the clipper5 module which provides your interface to the
system timer. It includes a simple test routine which you can exclude
from compilation by removing the #define _TEST from the source.
Tickerc.c:
C routines which modify the int 8 timer vector and handle the periodic
servicing of your specified clipper function.
MsAsm.asm:
Assembler replacements for the microsoft _dos_setvector(),
_dos_getvector(), and _enable() routines, so we don't need LLIBCA
to link. The new routines are called _setvector(), _getvector(), and
_intenable().
If you have any comments, questions, or encounter any bugs please
contact me -- I am interested in hearing what you think. These functions
have not been extensevly tested -- they have worked for me without error.
When I have found errors, I have fixed them -- If you find any please let
me know so I can make the required changes.
Brenton Farmer
CIS: 71621,627
If anyone wishes to use these routines permission is granted for use in
any finished program, commercial or otherwise. However, permission is not
granted to include these routines in third party commercial or shareware
LIBRARIES.